package com.sunshine.simplehospital.base

import android.app.Application
import android.content.Context
import android.content.SharedPreferences
import androidx.lifecycle.AndroidViewModel
import com.sunshine.simplehospital.bean.SimpleHospitalRepository
import com.sunshine.simplehospital.bean.UserInfo

/**
 * Created by sunshine on 2020/4/28
 */
open class BaseViewModel(application: Application) : AndroidViewModel(application) {
    private val baseAppInfo = application.getSharedPreferences("app_info", Context.MODE_PRIVATE)
    private val baseRepository = SimpleHospitalRepository(application)
    private var userInfo = UserInfo()

    fun getAppInfo(): SharedPreferences {
        return baseAppInfo
    }

    fun getRepository(): SimpleHospitalRepository {
        return baseRepository
    }

    fun setUserInfo(userInfo: UserInfo){
        this.userInfo = userInfo
    }
}